/*
 * @Author: 张小平
 * @Date:   2025-05-01
 * @Email:  qqshuqian@163.com
 * @Copyright © 2024 aseyun. All rights reserved.
 */

import { createApp } from 'vue'
import website from '@/framework-core/config/website'
import axios from '@/framework-core/axios';
import router from '@/framework-core/router';
import store from '@/framework-core/store';
import i18n from '@/framework-core/lang';
import { language, messages } from '@/framework-core/lang';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'




import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';

import crudCommon from '@/framework-core/mixins/crud.js'
import { getScreen,downloadFile } from '@/framework-core/utils/util'
import '@/framework-core/permission';
import error from '@/framework-core/error';

import App from './App.vue'
import 'animate.css'
import dayjs from 'dayjs'
import 'styles/common.scss'

// import AvueFormDesign from 'avue-form-design3'

import AvueFormDesign from '../packages/';

import drag from 'v-drag'

import basicBlock from '@/framework-core/components/basic-block/main.vue'
import basicContainer from '@/framework-core/components/basic-container/main.vue'


import AvueUeditor from 'avue-plugin-ueditor'

import Vant from 'vant';
import 'vant/lib/index.css';

// import vue3videoPlay from 'vue3-video-play' // 引入组件
// import 'vue3-video-play/dist/style.css' // 引入css


//# import {hiPrintPlugin} from 'vue-plugin-hiprint'
//
//#s https://gitee.com/c13933520379/exam_admin_avue/blob/master/src/views/page/admin_question/edit/true_or_false.vue


window.$crudCommon = crudCommon
window.axios = axios;

window.isMobile =/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
window.avuetable={};
window.avuetable.span = window.isMobile?24:12;
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}


app.component('basicContainer', basicContainer)
app.component('basicBlock', basicBlock)

app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.website = website
app.config.globalProperties.getScreen = getScreen
app.use(error);
app.use(i18n)
app.use(store)
app.use(router)
app.use(AvueFormDesign)
app.use(drag)


import {getDict,initOptionDict} from '@/framework-core/utils/dict'
app.config.globalProperties.$dictObject ={};
app.config.globalProperties.$initOptionDict =initOptionDict;
getDict(app.config.globalProperties.$dictObject );

import {getTenant} from '@/framework-core/utils/comm'
getTenant(app.config.globalProperties);

//alert( JSON.stringify(   app.config.globalProperties.$dmTenant ))


app.use(AvueUeditor);


app.use(ElementPlus, {
  locale: messages[language]
})
app.use(Avue, {
  axios,
  locale: messages[language]
})

app.use(Vant)

app.config.globalProperties.downloadFile = downloadFile
// window.downloadFile = downloadFile

import {getAvueComponent} from '@/framework-core/components/index'
var avueComponents = getAvueComponent();
if(avueComponents){
    for (let vkey in avueComponents) {
        app.component(vkey, avueComponents[vkey])
    }
}

import {getVantComponent} from '@/framework-core/components/avant/index'
var vantComponents = getVantComponent();
if(vantComponents){
    for (let vkey in vantComponents) {
        app.component(vkey, vantComponents[vkey])
    }
}


app.mount('#app')

// 设置全局属性 弹窗默认点击遮罩层不关闭
app._context.components.ElDialog.props.closeOnClickModal.default = false;


